package com.dc.project.workflow.vo;

import org.activiti.engine.query.Query;

import java.io.Serializable;

/**
 * @author zhuangcy
 * @date 2021/7/1
 * @description 流程查询分页实体
 */
public class ProcessQuery<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    private T list;

    private Long total;

    public ProcessQuery() {

    }

    public ProcessQuery(T data) {
        this.list = data;
    }

    public ProcessQuery(T data, Long count) {
        this.list = data;
        this.total = count;
    }

    public ProcessQuery<T> listPage(Query query, int current, int size) {
        current--;
        this.total = query.count();
        this.list = (T) query.listPage(current * size, size);
        return this;
    }

    public T getList() {
        return list;
    }

    public void setList(T list) {
        this.list = list;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }
}
